/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.maxato.domain;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.w3c.dom.Element;

/**
 *
 * @author Danny
 */
public class WeekAdapter extends XmlAdapter<Element, Week> {
    @Override
    public Week unmarshal(Element el) throws Exception {
        Week w = new Week();
        w.setWeek(Integer.parseInt(el.getNodeName().substring(4)));
        w.setScoreEvent(Integer.parseInt(el.getAttribute("score")));
        w.setValue(Double.parseDouble(el.getTextContent()));
        return w;
    }

    @Override
    public Element marshal(Week bt) throws Exception {
        throw new UnsupportedOperationException();
    }
}

